package cache

import (
	"context"
	"time"
)

type Cache interface {
	Get(key string) (interface{}, error) // 添加错误返回值
	Set(key string, value interface{}, duration time.Duration) error
	Foreach(fn func(key string, item *Item))        // 键类型改为 string
	ForeachExpired(fn func(key string, item *Item)) // 键类型改为 string
	Delete(key string) error
	Clear(ctx context.Context) error
}
